{extends file="../global.html"}
{block name=body}
 {if $res|@count eq 0}
	 <div class="container yuyue-top">
	 	<div class="row ">
	 		<h2 class="col-md-12 ft-32 hidden-xs title"> 我的关注</h2>
	 		<h2 class="col-md-12 ft-18 hidden-md hidden-lg hidden-sm"> 关注</h2>
	 			<div class="no-yueyue col-md-12 col-xs-12 " style="text-align: center;">
	 				<div class="center-block">
	 				<p>您还没有关注的车辆</p>
					<a href="{url('/type')}" class="btn btn-primary " role="button">去逛逛</a>
					</div>
	 			</div>
	 	</div>
	 </div>
{else}
<div class="container yuyue-top">
	<div class="row ">
		<h2 class="col-md-12 ft-32 hidden-xs title"> 我的关注</h2>
		<h2 class="col-md-12 ft-18 hidden-md hidden-lg hidden-sm"> 我的关注</h2>
		{foreach $res as $k=>$v}
		 <div class="col-md-4 col-sm-6 col-xs-12 wi-row del_{$v.goods_id}">
			<div class="sbtn" style="width: 25%; height: 30px;line-height: 30px;text-align: center;padding:0;position: absolute;right: 30px;top:4%;cursor: pointer;" onclick="delFollow({$v.goods_id})">取消关注</div>
			<div style="border:1px solid #ddd;margin" class="mar-di">

			<img src="{$absroot}{$v.goods_pic}" alt="" title="{$v.goods_model}款 {$v.goods_name} {$v.goods_describe} {$v.goods_car}" class="img-responsive" style="cursor: pointer;" onclick="goodsView({$v.goods_id})">
			<div class="car-content">
				<p class="p-title" style="height:auto;">{$v.goods_model}款 {$v.goods_name} {$v.goods_describe} {$v.goods_car}</p>
				<p style="color: #999;">指导价{$v.goods_price}</p>
				<p class="p-monney col-j" style="margin-top: 10px;">首付 <span>{$v.goods_payment}</span>万 月供{$v.goods_month}元</p>
			</div>
			</div>

		 </div>
		 {/foreach}
	</div>
</div>
{/if}
<!-- <script src="{$home}js/fang/common.js"></script> -->

<script type="text/javascript">

	function goodsView(goodsId){
		// alert(goodsId);
		 location.href="{$absroot}details/"+goodsId;
	}
	function delFollow(delGoodsId){
		
		var userPhone  = '{session(PHONE)}';
		 layer.confirm('确定取消关注？', {
		   btn: ['留着吧~','必须的'] //按钮
		 }, function(index){
		   layer.close(index);
		 }, function(){
		 	$.ajax({
		 		type:"post",
		 		url:"{url('home/Follow/ajaxDel')}",
		 		data:{ goods_id:delGoodsId,user_phone:userPhone},
		 		success:function(msg){
		 			
		 			layer.msg('拜拜了~', {
		 				time:1000
		 			},function(){
		 				var rowHtml = '<h2 class="col-md-12 ft-32 hidden-xs title">我的关注</h2><h2 class="col-md-12 ft-18 hidden-md hidden-lg hidden-sm">关注</h2><div class="no-yueyue col-md-12 col-xs-12 "style="text-align: center;"><div class="center-block"><p>您还没有关注的车辆</p><a href="{url('home/type/index')}"class="btn btn-primary "role="button">去逛逛</a></div></div>';
		 				$('.del_'+delGoodsId).toggle(200,function(){
		 					$(this).remove();
		 					if($('.wi-row').length==0){
		 						 $('.yuyue-top').find('.row').html('').append(rowHtml);
		 					}
		 				})
		 			});
		 			
		 		}
		 	})
		
		 });
	}
</script>

{/block}